﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:Imagin.Controls.Common">
    <Style x:Key="{x:Type local:Gadget}" TargetType="{x:Type local:Gadget}">
        <Setter Property="AllowsTransparency" Value="True" />
        <Setter Property="ResizeMode" Value="CanResize" />
        <Setter Property="WindowStyle" Value="None" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:Gadget}">
                    <Grid 
                        x:Name="PART_Border"
                        Margin="{Binding Source={x:Static SystemParameters.WindowNonClientFrameThickness}}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Border Height="24"/>
                        <Border 
                            Grid.Row="1"
                            WindowChrome.IsHitTestVisibleInChrome="True"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            ClipToBounds="True"
                            CornerRadius="{TemplateBinding CornerRadius}">
                            <AdornerDecorator>
                                <ContentPresenter VerticalAlignment="Center"/>
                            </AdornerDecorator>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="WindowChrome.WindowChrome">
            <Setter.Value>
                <WindowChrome
                    GlassFrameThickness="5"
                    ResizeBorderThickness="10"
                    UseAeroCaptionButtons="False" />
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>